package com.czxy.controller;

import com.czxy.pojo.User;
import com.czxy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Liuyunqin 17674029449@163.com
 * @date 2018/12/18 8:43
 */
@RestController
@RequestMapping
public class UserController {


    @Autowired
    private UserService userService;

    /**
     * 根据电话号码和密码查询用户
     * @param mobile
     * @param password
     * @return
     */
    @GetMapping("query")
    public ResponseEntity<User> findUserByMobile(@RequestParam("mobile") String mobile, @RequestParam("password") String password){
        User user = userService.findMobileAndPassword(mobile,password);
        return ResponseEntity.ok(user);
    }


}
